import java.sql.*;

public class SelectUserOrders {
	public static void main(String[] args) throws Exception {
		Connection connection = DriverManager.getConnection("jdbc:pointbase:server://localhost/StaplerzDB", "pbpublic", "pbpublic");
		
		String query = "SELECT name, status FROM users u, orders o WHERE u.userid=o.userid AND status=?";
		PreparedStatement selectStatement = connection.prepareStatement(query);
		selectStatement.setString(1, "Shipped");
		
		ResultSet result = selectStatement.executeQuery();
		
		while(result.next()){
			System.out.println(result.getString(1) + "\t" + result.getString(2) );
		}
		
		connection.close();
	}

}
